/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.core.repository.entity;

import com.gitee.peigenlpy.actable.annotation.Column;
import com.gitee.peigenlpy.actable.annotation.Index;
import com.gitee.peigenlpy.actable.annotation.Table;
import com.gitee.peigenlpy.actable.annotation.Unique;
import com.gitee.peigenlpy.actable.constants.MySqlCharsetConstant;
import com.gitee.peigenlpy.actable.constants.MySqlEngineConstant;
import com.gitee.peigenlpy.actable.constants.MySqlTypeConstant;
import info.peigen.hotpot.business.account.facade.enums.AccountFreezeDirection;
import info.peigen.hotpot.business.account.facade.enums.AccountFreezeType;
import info.peigen.hotpot.common.core.lang.money.Money;
import info.peigen.hotpot.component.data.repository.beetlsql.entity.AbstractCreateTimeEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.handler.MoneyBeetlSqlHandler;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;

/**
 * <b>(AccountFreezeLogEntity)</b>
 * 账户冻结解冻记录表
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/1
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
@Table(name = "account_freeze_log", comment = "账户冻结解冻记录表", charset = MySqlCharsetConstant.UTF8MB4, engine = MySqlEngineConstant.InnoDB)
@org.beetl.sql.annotation.entity.Table(name = "account_freeze_log")
public class AccountFreezeLogEntity extends AbstractCreateTimeEntity {
    @Column(name = "account_id", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "账户Id")
    @Index(value = "accountId", columns = "account_id")
    @org.beetl.sql.annotation.entity.Column("account_id")
    String                 accountId;
    @Column(name = "trade_id", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "交易Id")
    @Index(value = "tradeId", columns = "trade_id")
    @org.beetl.sql.annotation.entity.Column("trade_id")
    String                 tradeId;
    @Column(name = "freeze_type", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "冻结类型")
    @Unique(value = "freeze_log", columns = "account_id,trade_id,freeze_type,direction")
    @org.beetl.sql.annotation.entity.Column("freeze_type")
    AccountFreezeType      freezeType;
    @Column(name = "freeze_amount", type = MySqlTypeConstant.DECIMAL, length = 65, defaultValue = "0", comment = "冻结金额")
    @org.beetl.sql.annotation.entity.Column("freeze_amount")
    @MoneyBeetlSqlHandler
    Money                  freezeAmount;
    @Column(name = "direction", type = MySqlTypeConstant.VARCHAR, length = 10, isNull = false, comment = "方向;FREEZE:冻结;UNFREEZE:解冻")
    @org.beetl.sql.annotation.entity.Column("direction")
    AccountFreezeDirection direction;
    @Column(name = "reason", type = MySqlTypeConstant.VARCHAR, length = 1000, comment = "原因")
    @org.beetl.sql.annotation.entity.Column("reason")
    String                 reason;
    @Column(name = "bops_operator_id", type = MySqlTypeConstant.VARCHAR, length = 22, comment = "后台操作员")
    @Index(value = "bopsOperatorId", columns = "bops_operator_id")
    @org.beetl.sql.annotation.entity.Column("bops_operator_id")
    String                 bopsOperatorId;

}